package com.example.practice.example;

import com.google.common.base.Splitter;

import java.util.List;
import java.util.Map;

/**
 * TODO
 *
 * @author zgq
 * @date 2020/10/16 10:08
 */
public class StringAndCollectionFormat {

    public static void main(String[] args) {
        String string = "1w2w3w4w5";
        // string -> list
        List<String> w = Splitter.on("w").splitToList(string);
        System.out.println(w);

        //string -> map
        String string2 = "1=11,2=12,3=13";
        Map<String, String> split = Splitter.on(",").withKeyValueSeparator("=").split(string2);
        System.out.println(split);

        // list -> string
        String x = String.join("x", w);
        System.out.println(x);
    }

}
